<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<include file="Public/title" title="{$seotitle}" />
<style type="text/css">
	.ads_img{
		float: left;
		padding-left: 30px;
	}
	.ads_img p{padding: 10px;font-weight: bold}
</style>
</head>

<body>
<div class="mainWrap">

	<!--标题-->
    <div class="mainWrapHeader">
    	<h1 class="mainWrapTit">{$seotitle} -- {$activity_info['name']}
			<a href="/Admin/Order/exportByOrderNO?order_no={$order_info['order_no']}" class="submit" style="color:#fff;font-size:12px;">导出该笔订单信息</a>
			<a href="/Admin/Order/exportByOrderNO?store_id={$info['id']}" class="submit" style="color:#fff;font-size:12px;">导出门店订单信息</a>
    	</h1>        
        <!--切换需要，写对应ID，及class-->
    </div>
    <!--标题-->

    <div class="mainWrapBd">
    	<table cellpadding="0" border="0" cellspacing="0" class="stdedit">
            <tr>
                <th>活动名称</th>
                <td>{$activity_info['name']}</td>

                <th>订单号</th>
                <td>{$order_info['order_no']}</td>

                <th>订单状态</th>
                <td>
                	<if condition="$order_info['order_status']==0"><span style="color:#FF6666">待店长下单</span></if>
                    <if condition="$order_info['order_status']==1"><span style="color:green">店长已下单，待审核</span></if>
                    <if condition="$order_info['order_status']==2"><span style="color:red">审核未通过</span></if>
                    <if condition="$order_info['order_status']==3"><span style="color:green">进行中</span></if>
                    <if condition="$order_info['order_status']==4"><span style="color:green">上画待验收</span></if>
                    <if condition="$order_info['order_status']==5"><span style="color:green">上画验收完成</span></if>
                    <if condition="$order_info['order_status']==6"><span style="color:green">下画待验收</span></if>
                    <if condition="$order_info['order_status']==7"><span style="color:green">订单完成</span></if>
                    <if condition="$order_info['order_status']==11"><span style="color:green">高空物料待报价</span></if>
                    <if condition="$order_info['order_status']==12"><span style="color:green">高空物料报价待审核</span></if>
                    <if condition="$order_info['order_status']==13"><span style="color:green">高空报价审核失败</span></if>

                    <?php
                    	$is_upper_air = M('order_ads')->where(['order_no'=>$order_info['order_no'],'is_upper_air'])->find();

                    ?>
                    <!-- 店长已下单，且审核员已经完成订单审核 -->
                    <if condition="$order_info['order_status'] == 11 || $order_info['order_status'] == 13">
                    	<a href="javascript:;" class="submit upper_open" style="color:#fff">高空报价</a>
                	</if>

                	<if condition="$order_info['order_status'] == 3">
                    	<a href="javascript:;" class="submit order_open" style="color:#fff">接收订单</a>
                	</if>
                </td>

            </tr>

            <tr>               
                <th>店铺名称</th>
                <td>{$info['store_name']}</td>

                <th>店长</th>
                <td>{$info['manager_name']} - {$info['mobile']}</td>

                <th>物料状态</th>
                <td>物料统一配送</td>

            </tr>

            <tr>
                <th>审核员</th>
                <td>{$info['name']} - {$info['mobile']}</td>

                <th>安装地址</th>
                <td>{$info['address']}</td>

                <th>下单时间</th>
                <td>{$order_info['update_time']|date="Y/m/d h:i",###}</td>

            </tr>

            <tr>
                <th>安装时间</th>
                <td>{$order_info['up_time']|date="Y/m/d h:i",###}</td>

                <th>是否下画</th>
                <td>{$order_info['down_time']|date="Y/m/d h:i",###}</td>

                <if condition="$order_info['parter_fee'] neq ''">
                	<th>高空报价</th>
                	<td style="color: red">{$order_info['parter_fee']} / {$order_info['upper_fee']}</td>
                </if>

            </tr>
            
        </table>

    </div>	

	<!-- <div id="upper_con"><table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist"><tr><td>城市合伙人报价</td><td><input type="text" name="parter_price" class="sys_text"/></td></tr><tr><td>订单高空费用</td><td><input type="text" name="upper_price"  class="sys_text"/></td></tr><tr><td colspan="2"><input type="button" class="submit" id="upper_commit" value="确定报价"/></td></tr></table></div> -->
	
    <!--标题-->
    <div class="mainWrapHeader">
        <ul class="tab-nav clearfix">
            <li class="cur"><a href="#tab-info">物料信息</a></li>
            <li><a href="#tab-status">订单进度</a></li>
            <li><a href="#tab-ads">广告效果</a></li>
        </ul>
        <!--切换需要，写对应ID，及class-->
    </div>
    <!--标题-->
    
    <div class="mainWrapBd">
    	<div class="tab-con" id="tab-info">

    		<?php
				$ads = M("order_ads a")
						->field("a.*")
						->where(['a.order_id'=>$order_info['id']])->select();

			?>
        	
            <!--列表-->
		
			<volist name="ads" id="ads_fo">

		        <table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist" style="margin:10px;">
		            <colgroup>
		                <col />
		                <col />
		                <col />
		                <col />
		                <col />
		            </colgroup>
		           
		            <tbody>
						
						<if condition="$ads_fo['ads_type'] == 1">
							<tr style="height:36px;">
			                    <td colspan="6">
									{$ads_fo['ads_name']} |
									数量：{$ads_fo['num']} | 
									尺寸：{$ads_fo['width']}*{$ads_fo['height']} |
									是否高空：{$ads_fo['is_upper_air'] == 1 ? '高空' : '非高空'}
									<!-- <a href="javascript:;" class="submit upper_open" style="color:#fff">高空报价</a> -->
			                    </td>
			                </tr>
						
						<else/>

							<tr style="height:66px;">
			                    <td>
			                    	<span style="color:red">*自定义广告位*</span><br/>
									名称：{$ads_fo['ads_name']} <br/>
									数量：{$ads_fo['num']} <br/>
									是否高空：{$ads_fo['is_upper_air'] == 1 ? '高空' : '非高空'}<br/>
									<!-- <a href="javascript:;" class="submit upper_open" style="color:#fff">高空报价</a> -->
			                    </td>

			                    <td>
									材料：{$ads_fo['materiel_id']} <br/>
									尺寸：{$ads_fo['width']}*{$ads_fo['height']} <br/>
									备注：{$ads_fo['remark']}
			                    </td>

			                    <td>
									效果图：
									<?php
										$i = M("activity_image")->where(['id'=>$ads_fo['activity_image_id']])->find();
									?>
									{$i['image_name']}
									<img src="{$i['image_url']}" style="width:100px;"/>
			                    </td>
			                </tr>

						</if>

						


		                <?php
		                	$ads_detail = M('order_ads_detail')->where(['order_ads_id'=>$ads_fo['id']])->select();
		                ?>

						<volist name="ads_detail" id="po">
		                <tr>
		                    <td>位置：{$po['ads_name']}</td>
		                    <td>材料：{$po['materiel_name']}</td>
		                    <td>坐标：X:{$po['x_axis']}&nbsp;&nbsp; Y:{$po['y_axis']}</td>
		                    <td>尺寸：{$po['width']} * {$po['height']}</td>
		                    <td>效果图：<a href="{$po['activity_image_url']}" target="_blank"><img src="{$po['activity_image_url']}" style="wdith:100px;height:100px;"/></a></td>
		                    <td>备注：{$po['remark']}</td>        
		                </tr>
						</volist>
		                
		                <!-- <if condition="$pages['total'] eq 0">
		                <tr>
		                    <td align="center" class="data-nothing" colspan="8">暂无相关信息</td>
		                </tr>
		                </if> -->
		            </tbody>
		        </table>

	    	</volist>
	        <!--列表-->
            
        </div>

		

        <div class="tab-con" id="tab-status" style="display:none;">

        	<!--列表-->
	        <table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist">
	            <colgroup>
	                <col />
	                <col />
	                <col />
	                <col />
	            </colgroup>
	           
	            <tbody>
	                <tr>
	                    <td>物料制作下单</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>订单审核通过</td>
	                    <td>由李思思审核</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>订单已接收</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>物料统一配送</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>待上画</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>待上画验收</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>待下画</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>待下画验收</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>

	                <tr>
	                    <td>已完成</td>
	                    <td>由张三三下单</td>
	                    <td>2019/01/22 17:25</td>
	                    <td>xxx</td>        
	                </tr>
	                <!-- <if condition="$pages['total'] eq 0">
	                <tr>
	                    <td align="center" class="data-nothing" colspan="8">暂无相关信息</td>
	                </tr>
	                </if> -->
	            </tbody>
	        </table>
	        <!--列表-->
        	
        </div>

        <!-- <div id="order_con">
        	<table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist">
        		<tr>
        			<td>物料状态</td>
        			<td>
        				<select>
        					<option value="0">物料配送方式</option>
        					<option value="1">师傅带去</option>
        					<option value="2">统一配送</option>
        				</select>
        			</td>
        		</tr>
        		
        		<tr>
        			<td>上画人数</td>
        			<td><input type="text" id="up_num"  class="sys_text" value="1"/></td>
        		</tr>

        		<tr>
        			<td>师傅</td>
        			<td><input type="text" id="up_worder"  class="sys_text"/><span style="color:red"> *多个以逗号隔开 </span></td>
        		</tr>

        		<tr>
        			<td>下画人数</td>
        			<td><input type="text" id="down_num"  class="sys_text" value="1"/></td>
        		</tr>

        		<tr>
        			<td>师傅</td>
        			<td><input type="text" id="down_worder"  class="sys_text"/><span style="color:red"> *多个以逗号隔开 </span></td>
        		</tr>
        		
        		<tr>
        			<td colspan="2"><input type="button" class="submit" id="order_commit" value="确认发单"/></td>
        		</tr>
        	</table>
        </div> -->

        <?php
        	$worker = M('worker')->where(['status'=>3])->select();
        ?>

        <div class="tab-con" id="tab-ads" style="display:none;">
	
			<volist name="ads" id="ao">
	        	<div class="ads_img">
	        		<p>{$ao['ad_name']} ({$ao['width']}*{$ao['height']})</p>
	        		<a href="/{$ao['filepath']}" target="_blank"><img src="/{$ao['filepath']}" style="width:300px;height:300px;"/></a>
	        	</div>
	        </volist>

        </div>
    </div>
    
</div>
</body>
</html>

<script type="text/javascript">

	
	
	$(".upper_open").click(function(event) {

		var upper_con = '<div id="upper_con"><table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist"><tr><td>城市合伙人报价</td><td><input type="text" id="parter_fee" class="sys_text"/></td></tr><tr><td>订单高空费用</td><td><input type="text" id="upper_fee"  class="sys_text"/></td></tr><tr><td colspan="2"><input type="button" class="submit" id="upper_commit" value="确定报价"/></td></tr></table></div>';

		//页面层
		layer.open({
			type: 1,
			title: "高空报价",
			skin: 'layui-layer-rim', //加上边框
			area: ['420px', '240px'], //宽高
			content: upper_con
		});
	});

	$("#upper_commit").live("click",function(){

		var order_no = {$order_info['order_no']};
		var parter_fee = $("#parter_fee").val();
		var upper_fee = $("#upper_fee").val();

		if(parter_fee == '' || upper_fee == '' ){
			alert('请输入相关报价费用');
			return false;
		}
	  	
		$.post('{:U("upper_fee")}',{"order_no":order_no,"parter_fee":parter_fee,"upper_fee":upper_fee},function(d){

			alert(d.msg);

		},"json");

	});

	//分配订单
	$(".order_open").click(function(event) {

		var order_con = '<div id="order_con"><table cellpadding="0" cellspacing="0" border="0" class="stdtable stdtablelist"><tr><td>物料状态</td><td><select name="service_type"><option value="0">物料配送方式</option><option value="1">师傅带去</option><option value="2">统一配送</option><option value="3">快递配送</option></select></td></tr><tr><td>上画人数</td><td><input type="text" id="up_num"  class="sys_text" value="1"/></td></tr><tr><td>队长</td><td><volist name="worker" id="vo"><input type="radio" name="worker_first" value="{$vo.id}"><label>{$vo.name}</label></volist></td></tr><tr><td>师傅</td><td><volist name="worker" id="vo"><input type="checkbox" name="worker" value="{$vo.id}"><label>{$vo.name}</label></volist></td></tr><tr><td colspan="2"><input type="button" class="submit" id="order_commit" value="确认发单"/></td></tr></table></div>';

		//页面层
		layer.open({
			type: 1,
			title: "接收订单",
			skin: 'layui-layer-rim', //加上边框
			area: ['450px', '450px'], //宽高
			content: order_con
		});
	});

	$("#order_commit").live("click",function(){

		var order_no = {$order_info['order_no']};
		var up_num = $("#up_num").val();
		var worker_first = $(":input[name=worker_first]:checked").val();
		var service_type = $(":input[name=service_type]").val();
		var worker = [];
		$(":input[name=worker]:checked").each(function(){ 
	        worker.push($(this).val()); 
	    }); 

		if(service_type == 0){
			alert('请选择物料配送方式');
			return false;
		}

		//只有一个师傅
	    if(up_num == 1){

	    	if(worker.length != 1){
	    		alert('当前需选择一个师傅');
	    		return false;
	    	}

	    	if(worker_first != worker){
	    		alert('当前队长和师傅必须是同一人');
	    		return false;
	    	}
	    }

	    //大于一个师傅
	    if(up_num > 1){
	    	if(worker.length != up_num){
	    		alert('请选择合适的师傅数量');
	    		return false;
	    	}
	    }
		
	  	
		$.post('{:U("order_commit")}',{"order_no":order_no,"service_type":service_type,"up_num":up_num,"worker_first":worker_first,"worker":worker},function(d){

			alert(d.msg);

		},"json");

	});
	

</script>